extends ../layout

block content
    script
        - 'use strict';
        -
        - var timeFormat = function (timestamp) {
        -    var sec = (Date.now() - timestamp) / 1e3 >> 0;
        -    if (sec >= 86400) return `${sec / 86400 >> 0}天`;
        -    if (sec >= 3600) return `${sec / 3600 >> 0}小时`;
        -    if (sec >= 60) return `${sec / 60 >> 0}分钟`;
        -    else return `${sec}秒`;
        - };
    #postform
        form(method="POST", action="/post")
            | #{uname}, 有啥感想?
            br
            table
                tr
                    td
                        textarea(cols="70", rows="3", name="status")
                tr
                    td(align="right")
                        input(type="submit", name="doit", value="Update")
        #homeinfobox
            | #{followersCount} 粉丝
            br
            | #{starCount} 关注
            br
    .post
        each postItem in postList
            a.username(href="/profile?u=#{postItem.uname}") #{postItem.uname}
            | #{postItem.content}
            br
            i #{timeFormat(postItem.time)} 前 通过 web发布
            hr
